package com.itqf.config;

import org.springframework.cloud.netflix.zuul.filters.discovery.PatternServiceRouteMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Description:
 * @Company: 千锋互联
 * @Author: 李丽婷
 * @Date: 2020/12/25
 * @Time: 上午9:50
 */
@Configuration
public class ZuulConfig {

    /**
     * 灰度发布的关键配置
     * @return
     */
    @Bean
    public PatternServiceRouteMapper serviceRouteMapper() {
        return new PatternServiceRouteMapper(
                "(?<name>^.+)-(?<version>v.+$)",//服务名:eureka-client-provider-v1
                "${version}/${name}");//映射的访问路径
//        http://localhost:8888/v1/eureka-client-provider/方法名
//        http://localhost:8888/v2/eureka-client-provider/方法2

    }

}
